import { RuleParam } from "./types";

export const AllCopParamList: RuleParam[] = [
    {
        param: "RubyInterpreters",
        defaultValue: ["ruby", "macruby", "rake", "jruby", "rbx"],
        descCn: "解释器列表",
    },
    {
        param: "Include",
        defaultValue: ["**/*.rb", "**/*.arb", "**/*.axlsx", "**/*.builder", "**/*.fcgi",
            "**/*.gemfile", "**/*.gemspec", "**/*.god", "**/*.jb", "**/*.jbuilder",
            "**/*.mspec", "**/*.opal", "**/*.pluginspec", "**/*.podspec", "**/*.rabl",
            "**/*.rake", "**/*.rbuild", "**/*.rbw", "**/*.rbx", "**/*.ru", "**/*.ruby",
            "**/*.spec", "**/*.thor", "**/*.watchr", "**/.irbrc", "**/.pryrc",
            "**/.simplecov", "**/buildfile", "**/Appraisals", "**/Berksfile", "**/Brewfile",
            "**/Buildfile", "**/Capfile", "**/Cheffile", "**/Dangerfile", "**/Deliverfile",
            "**/Fastfile", "**/*Fastfile", "**/Gemfile", "**/Guardfile", "**/Jarfile",
            "**/Mavenfile", "**/Podfile", "**/Puppetfile", "**/Rakefile", "**/rakefile",
            "**/Snapfile", "**/Steepfile", "**/Thorfile", "**/Vagabondfile", "**/Vagrantfile"],
        descCn: "包含路径",
    },
    {
        param: "Exclude",
        defaultValue: ["node_modules/**/*", "tmp/**/*", "vendor/**/*", ".git/**/*"],
        descCn: "排除路径"
    },
    {
        param: "DefaultFormatter",
        defaultValue: "progress",
        optionList: ["progress", "autogenconf", "clang", "fuubar", "pacman",
            "emacs", "simple", "quiet", "files", "json", "junit", "offenses",
            "worst", "html", "markdown", "tap", "github"],
        descCn: "如果没有给出“-f/--format”选项，将使用默认格式化程序。",
        descEn: "Default formatter will be used if no `-f/--format` option is given.",
    },
    {
        param: "DisplayCopNames",
        defaultValue: true,
        descCn: "默认情况下，检查的名字会显示在信息中。通过重写DisplayCopNames或提供“--no display cop-names”选项来更改行为。",
        descEn: "Cop names are displayed in offense messages by default. Change behavior by overriding DisplayCopNames, or by giving the `--no-display-cop-names` option."
    },
    {
        param: "DisplayStyleGuide",
        defaultValue: false,
        descCn: "默认情况下，风格指南URL不会显示在消息中。通过重写“DisplayStyleGuide”或提供“-S/--display-style-guide”选项来更改行为。",
        descEn: "Style guide URLs are not displayed in offense messages by default. Change behavior by overriding `DisplayStyleGuide`, or by giving the `-S/--display-style-guide` option.",
    },
    {
        param: "StyleGuideBaseURL",
        defaultValue: "https://rubystyle.guide",
        descCn: "当指定风格指南URL时，任何路径和/或片段都将相对于基本URL进行生成。",
        descEn: "When specifying style guide URLs, any paths and/or fragments will be evaluated relative to the base URL.",
    },
    {
        param: "DocumentationBaseURL",
        defaultValue: "https://docs.rubocop.org/rubocop",
        descCn: "文档URL将使用基本URL构建。",
        descEn: "Documentation URLs will be constructed using the base URL."
    },
    {
        param: "ExtraDetails",
        defaultValue: false,
        descCn: "默认情况下，额外的细节不会显示在消息中。通过重写ExtraDetails或提供“-E/--extra-details”选项来更改行为。",
        descEn: "Extra details are not displayed in offense messages by default. Change behavior by overriding ExtraDetails, or by giving the `-E/--extra-details` option.",
    },
    {
        param: "StyleGuideCopsOnly",
        defaultValue: false,
        descCn: "默认情况下，可能会启用不引用样式指南规则的其他检查。通过重写“StyleGuideCopsOnly”或提供“--only guide-cops”选项来更改行为。",
        descEn: "Additional cops that do not reference a style guide rule may be enabled by default. Change behavior by overriding `StyleGuideCopsOnly`, or by giving the `--only-guide-cops` option.",
    },
    {
        param: "EnabledByDefault",
        defaultValue: false,
        descCn: "打开全部规则",
    },
    {
        param: "DisabledByDefault",
        defaultValue: false,
        descCn: "关闭规则",
    },
    {
        param: "NewCops",
        defaultValue: "pending",
        optionList: ["enable", "disable", "pending"],
        descCn: "新规则的处理逻辑。当设置成enable时，所有标记pending的都会被打开,当设置成disable时，所有标记pending的都会被关闭。"
    },
    {
        param: "UseCache",
        defaultValue: true,
        descCn: "如果为“true”，则启用结果缓存。可以由“--cache”命令行选项覆盖。",
        descEn: "Enables the result cache if `true`. Can be overridden by the `--cache` command line option.",
    },
    {
        param: "MaxFilesInCache",
        defaultValue: 20000,
        descCn: "在自动删除某些文件之前，可以在结果缓存中存储多少文件的阈值。",
        descEn: "Threshold for how many files can be stored in the result cache before some of the files are automatically removed."
    },
    {
        param: "CacheRootDirectory",
        defaultValue: null,
        demoValue: "",
        descEn: "The CacheRootDirectory can be overwritten by passing the `--cache-root` command line option or by setting `$RUBOCOP_CACHE_ROOT` environment variable.",
        descCn: "可以通过传递“--cache root”命令行选项或设置“$RUBOCOP_CACHE_ROOT”环境变量来覆盖CacheRootDirectory。",
    },
    {
        param: "AllowSymlinksInCacheRootDirectory",
        defaultValue: false,
        descEn: "It is possible for a malicious user to know the location of RuboCop's cache directory by looking at CacheRootDirectory, and create a symlink in its place that could cause RuboCop to overwrite unintended files, or read malicious input.",
        descCn: "恶意用户可以通过查看CacheRootDirectory来知道RuboCop缓存目录的位置，并在其位置创建符号链接，这可能会导致RuboCop覆盖意外文件或读取恶意输入。",
    },
    {
        param: "TargetRubyVersion",
        defaultValue: null,
        demoValue: "",
        descCn: "目标Ruby版本",
    },
    {
        param: "SuggestExtensions",
        defaultValue: {
            "rubocop-rails": [
                "rails"
            ],
            "rubocop-rspec": [
                "rspec",
                "rspec-rails"
            ],
            "rubocop-minitest": [
                "minitest"
            ],
            "rubocop-sequel": [
                "sequel"
            ],
            "rubocop-rake": [
                "rake"
            ],
            "rubocop-graphql": [
                "graphql"
            ],
            "rubocop-capybara": [
                "capybara"
            ]
        },
        validValue: (value: unknown) => {
            if (typeof value !== "object") {
                return "配置必须是一个对象";
            }
            for (const [_, v] of Object.entries(value as Object)) {
                if (!Array.isArray(v)) {
                    return "对象值必须是数组";
                }
                for (const iv of (v as unknown[])) {
                    if (typeof iv != "string") {
                        return "对象值必须是字符串数组";
                    }
                }
            }
            return null;
        },
        descEn: "Determines if a notification for extension libraries should be shown when rubocop is run. Keys are the name of the extension, and values are an array of gems in the Gemfile that the extension is suggested for, if not already included.",
        descCn: "确定在运行rubocop时是否应显示扩展库的通知。键是扩展名，值是Gemfile中的一个gem数组，如果还没有包括扩展名，则建议使用该扩展名。",
    },
    {
        param: "ActiveSupportExtensionsEnabled",
        defaultValue: false,
        descCn: "启用/禁用检查Active Support扩展的方法。",
        descEn: "Enable/Disable checking the methods extended by Active Support.",
    }
];